
** Figure 1

********************************************************************************

* REDS1999 - First Stage

********************************************************************************
use "$OUTDATA/REDS_sample.dta", clear

global cov "scstbc rural christian hindu"
global cov1 "years_schooling owns_land hh_members"
global cov2 "years_schooling_spouse"

global fe1   "i.state i.yy_1marr"
global fe2   "i.state i.yearb"
global did 	 "i.dow_cohort##i.hindu1"
global cluster "state"

global graph "xlabel(, noticks) ylabel(, nogrid) scheme(s2mono) plotregion(fcolor(white) lcolor(white) margin(small)) graphregion(fcolor(white) lcolor(white) ifcolor(white) ilcolor(white))"


* Labels for Tables

label var dow_99 "\shortstack{Gross \\ Dowry}"
label var downet_99 "\shortstack{Net \\ Dowry}"
label var zdow "\shortstack{Zero \\Dowry}"
label var missingdow "\shortstack{Missing \\Dowry}"




* imputation DID -  imputation approach of Borusyak, Jaravel, and Spiess(2021)

gen yy_1marr2 = yy_1marr

forvalues i = 1976(2)1984 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'-1
	 }

forvalues i = 1986(2)1998 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'+1
	 }


gen yy_1marr1 = 1     if yy_1marr2==1976
replace yy_1marr1 = 2 if yy_1marr2==1978
replace yy_1marr1 = 3 if yy_1marr2==1980
replace yy_1marr1 = 4 if yy_1marr2==1982
replace yy_1marr1 = 5 if yy_1marr2==1984
replace yy_1marr1 = 6 if yy_1marr2==1985
replace yy_1marr1 = 7 if yy_1marr2==1986
replace yy_1marr1 = 8 if yy_1marr2==1988
replace yy_1marr1 = 9 if  yy_1marr2==1990
replace yy_1marr1 = 10 if yy_1marr2==1992
replace yy_1marr1 = 11 if yy_1marr2==1994
replace yy_1marr1 = 12 if yy_1marr2==1996
replace yy_1marr1 = 13 if yy_1marr2==1998

gen E1 = 7 if hindu1==1
replace E1 = . if hindu1==0
gen id3 = _n


* Figure 1(A)

did_imputation dow_99 id3 yy_1marr1 E1, fe(hindu1 yy_1marr1 state) controls(scstbc) cluster(state) autosample allhorizons  pretrends(6)
ereturn list


coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6 pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)"pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)" , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted   ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985")  $graph
graph export "$OUTFIG/dow99_reds_impute.png",replace 

* Figure 1(B)

did_imputation downet_99 id3 yy_1marr1 E1, fe(hindu1 yy_1marr1 state) controls(scstbc) cluster(state) autosample allhorizons  pretrends(6)
ereturn list

coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6 pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)"pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)" , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted   ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985") $graph
graph export "$OUTFIG/dow99net_reds_impute.png",replace 

* Figure 1(C)

did_imputation zdow id3 yy_1marr1 E1, fe(hindu1 yy_1marr1 state) controls(scstbc) cluster(state) autosample allhorizons  pretrends(6)
ereturn list

coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6 pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)"pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)" , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted   ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985") $graph
graph export "$OUTFIG/dow99zdow_reds_impute.png",replace 



use "$OUTDATA/NFHS_sample.dta", clear 



** set year of marriage in two year bins

gen yy_1marr2 = yy_1marr
forvalues i = 1976(2)1984 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'-1
	 }

forvalues i = 1986(2)1998 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'+1
	 }
	 

gen yy_1marr1 = 1     if yy_1marr2==1976
replace yy_1marr1 = 2 if yy_1marr2==1978
replace yy_1marr1 = 3 if yy_1marr2==1980
replace yy_1marr1 = 4 if yy_1marr2==1982
replace yy_1marr1 = 5 if yy_1marr2==1984
replace yy_1marr1 = 6 if yy_1marr2==1985
replace yy_1marr1 = 7 if yy_1marr2==1986
replace yy_1marr1 = 8 if yy_1marr2==1988
replace yy_1marr1 = 9 if  yy_1marr2==1990
replace yy_1marr1 = 10 if yy_1marr2==1992
replace yy_1marr1 = 11 if yy_1marr2==1994
replace yy_1marr1 = 12 if yy_1marr2==1996
replace yy_1marr1 = 13 if yy_1marr2==1998
replace yy_1marr1 = 14 if yy_1marr2==2000


gen E1 = 7 if hindu1==1
replace E1 = . if hindu1==0
gen id3 = _n



** Figure 1(D)
did_imputation sayl id3 yy_1marr1 E1 [aw= v005] , fe(hindu1 yy_1marr1 state) controls(rural scstbc) cluster(state) autosample allhorizons  pretrends(6) 
ereturn list

//event_plot, default_look graph_opt(xtitle("Years since the event") ytitle("Coefficients") title("Say in Large Purchases"))  alpha(0.1)

coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6  pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6   ) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)" pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)" , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985")  ytitle("") $graph
graph export "$OUTFIG/sayfinal.png",replace 


** Figure 1(E)
did_imputation viol_p2 id3 yy_1marr1 E1 [aw= v005] , fe(hindu1 yy_1marr1 state) controls(rural scstbc)  cluster(state) autosample allhorizons  pretrends(6)
ereturn list

coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6   pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6   ) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)" pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)"  , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985")  ytitle("") $graph
graph export "$OUTFIG/severeviolfinal.png",replace 


**** Separation outcome 


eststo clear
	
	
use "$OUTDATA/NFHS_sample_withdivorce.dta", clear 

cap gen divsep = v501>=4
replace divsep = . if v501 == . | v501 == 3
replace divsep = 1 if husbandelse == 1



gen yy_1marr2 = yy_1marr
forvalues i = 1976(2)1984 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'-1
	 }

forvalues i = 1986(2)1998 {
	 replace yy_1marr2 = `i' if yy_1marr2 == `i'+1
	 }
	 

gen yy_1marr1 = 1     if yy_1marr2==1976
replace yy_1marr1 = 2 if yy_1marr2==1978
replace yy_1marr1 = 3 if yy_1marr2==1980
replace yy_1marr1 = 4 if yy_1marr2==1982
replace yy_1marr1 = 5 if yy_1marr2==1984
replace yy_1marr1 = 6 if yy_1marr2==1985
replace yy_1marr1 = 7 if yy_1marr2==1986
replace yy_1marr1 = 8 if yy_1marr2==1988
replace yy_1marr1 = 9 if  yy_1marr2==1990
replace yy_1marr1 = 10 if yy_1marr2==1992
replace yy_1marr1 = 11 if yy_1marr2==1994
replace yy_1marr1 = 12 if yy_1marr2==1996
replace yy_1marr1 = 13 if yy_1marr2==1998
replace yy_1marr1 = 14 if yy_1marr2==2000


gen E1 = 7 if hindu1==1
replace E1 = . if hindu1==0
gen id3 = _n


** Figure 1(F)
did_imputation divsep id3 yy_1marr1 E1 [aw= v005] , fe(hindu1 yy_1marr1 state) controls(rural scstbc)  cluster(state) autosample allhorizons  pretrends(6)
ereturn list

coefplot, level(90) keep( tau0 tau1 tau2 tau3 tau4 tau5 tau6 tau7   pre1 pre2 pre3 pre4 pre5 pre6 ) ///
order(pre5 pre4 pre3 pre2 pre1 pre6 tau0 tau1 tau2 tau3 tau4 tau5 tau6   ) ///
coeflabels( pre5 = "(-10,-9)" pre4 = "(-8,-7)" pre3 = "(-6,-5)" pre2 = "(-4,-3)" pre1 = "(-2,-1)" pre6 = " " ///
tau0 = "(1,2)" tau1 = "(3,4)" tau2 = "(5,6)" tau3 = "(7,8)" tau4 = "(9,10)" tau5 = "(11,12)" tau6 = "(13,14)" tau7 = "(15,16)" , angle(45)) vert yline(0, lcol(black) lp(black) lw(thin))  omitted ///
yline(0, lcol(black) lp(black) lw(thin)) xline(6, lcolor(red) lpattern(dash)) cirecast(rcap) xtitle("Years from 1985")  ytitle("") $graph
graph export "$OUTFIG/separation_event.png",replace 













